class Solution {
    vector<int> v;
public:
    void Insert(int num) {
        v.push_back(num);
    }

    double GetMedian() {
        sort(v.begin(), v.end());
        int i = v.size();
        if (i % 2 == 0)
        {
            int a = i / 2 - 1;
            int b = a + 1;
            double mid = ((v[a] + v[b]) * 1.0) / 2;
            return mid;
        }
        int j = i / 2;
        return v[j];
    }

};